/*
 * Copyright (c) csii.com.cn 2016 zhaojin
 */

'use strict';
requirejs.config({
    baseUrl: (document.getElementById('contextPath').value + '/static/js'),
    paths: {
        'domReady': 'bower_components/requirejs-domReady/domReady',
        'underscore': 'bower_components/underscore/underscore',
        'jquery': 'bower_components/jquery/jquery',
        'zepto': 'bower_components/zepto/zepto',
        'touch': 'bower_components/zeptotouch/zepto-touch',
        'zepto-custom': 'zepto-custom',
        'SparkMD5':'bower_components/SparkMD5/spark-md5'
    },
    map: {
        '*': {
            'zepto': 'zepto-custom'
        }, 'zepto-custom': {
            'zepto': 'zepto'
        }
    },
    shim: {
        'underscore': {
            exports: '_'
        }, 'jquery': {
            exports: 'jQuery'
        }, 'zepto': {
            exports: 'Zepto'
        }, 'touch': {
            deps: ['zepto']
        },'detect': {
            deps: ['zepto']
        },'zepto-custom':{
            exports: ['$']
        }
    },
    urlArgs: "bust=" + (new Date()).getTime(),//生产需要移除
    waitSeconds: 10,
    onError: function (err) {
        console.error(err);
    }
});

require([
    'domReady!',
    'app',
    document.getElementById('viewPairedScriptPath').value
], function (doc, app, view) {
    app.init();
    if (!!view) {
        view.init();
    } else {
        console.warn('view is undefined!!');
    }
});